package br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.leftmenu.user;

import com.gwtext.client.data.SimpleStore;

/**
 * @author Renato Miceli
 */
public class AuthorizationSearchStore extends SimpleStore {

	public AuthorizationSearchStore() {
		super(new String[] { getColumnName() }, new String[][] {  new String[] { "Any" }, new String[] { "Authorized" }, new String[] { "Not Authorized" } });
		this.load();
	}

	public static Boolean getAuthorization(String value) {
		if (value.equals("Authorized")) {
			return true;
		} else if (value.equals("Not Authorized")) {
			return false;
		} else {
			System.err.println("VALUEEEE AUTHORIZATION: " + value);
			return null;
		}
	}

	public static String getValue(Boolean authorized) {
		if(authorized == null){
			return "Any";
		}
		
		if(authorized){
			return "Authorized";
		}
		
		return "Not Authorized";
	}

	public static String getColumnName() {
		return "authorized";
	}

}
